package com.qingsong.entity;

import com.mybatisflex.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * 订单明细表 实体类。
 *
 * @author qingsong
 * @since 2024-12-22
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table(value = "order_detail", schema = "ml_oms")
public class OrderDetail implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键
     */
    @Id(keyType = KeyType.Auto)
    private Long id;

    /**
     * 订单ID
     */
    private Long fkOrderId;

    /**
     * 课程ID
     */
    private Long fkCourseId;

    /**
     * 课程标题
     */
    private String courseTitle;

    /**
     * 课程封面图
     */
    private String courseCover;

    /**
     * 课程单价，单位元
     */
    private Double coursePrice;

    /**
     * 数据版本
     */
    @Column(version = true)
    private Long version;

    /**
     * 逻辑删除,0未删除,1已删除
     */
    @Column(isLogicDelete = true)
    private Integer deleted;

    /**
     * 创建时间
     */
    private LocalDateTime created;

    /**
     * 修改时间
     */
    private LocalDateTime updated;

    @RelationOneToOne(selfField = "fkOrderId", targetField = "id")
    private Order order;

    @RelationOneToOne(selfField = "fkCourseId", targetField = "id")
    private Course course;

}
